//
// Created by tang on 23-4-23.
//

#ifndef PIINFO_META_PARSER_HPP
#define PIINFO_META_PARSER_HPP

#include "common/namespace.h"
#include "parser/cursor.hpp"
#include "types/class.hpp"

class meta_parser {
public:
    meta_parser(std::string source_path);

    void prepare();

    bool parser(const Cursor &cursor);

    bool generate(const std::string &out_path);

    bool finish();

private:
    bool build_class_ast(const Cursor &cursor, Namespace &current_ns);

    bool add_codegen_class(Class *cls);

    std::string    source_path_;
    Cursor::Filter source_filter_;

    std::unordered_map<std::string, std::shared_ptr<Class>> classes_;
};

#endif  // PIINFO_META_PARSER_HPP
